home *** CD-ROM | disk | FTP | other *** search
/ Champak 141 / (Vol 141) Oct 17 2011.iso / Games / gamma-bros.swf / scripts / __Packages / classes / bro / Bro2.as < prev    next >
Encoding:
Text File  |  2011-10-17  |  31.7 KB  |  1,107 lines

  1. class classes.bro.Bro2
  2. {
  3.    var tX;
  4.    var x;
  5.    var tY;
  6.    var y;
  7.    var clip;
  8.    var w;
  9.    var h;
  10.    var weapon;
  11.    var trans;
  12.    var colorTrans;
  13.    var colorVars;
  14.    var baseSpeed;
  15.    var speed;
  16.    var fireDir;
  17.    var dc;
  18.    var fireFreq;
  19.    var fireFreqOrig;
  20.    var shotX;
  21.    var shotY;
  22.    var dirX;
  23.    var dirY;
  24.    var destX;
  25.    var destY;
  26.    var xyMetFunction;
  27.    var dirXArray;
  28.    var dirYArray;
  29.    var fire;
  30.    var oldLegState;
  31.    var d = 999985;
  32.    var c = 0;
  33.    var c2 = 0;
  34.    var fc = 0;
  35.    var shotID = 0;
  36.    var xA = 0;
  37.    var yA = 0;
  38.    var f2 = "";
  39.    var facing = "R";
  40.    var hc = 0;
  41.    var legState = "still";
  42.    var inv = false;
  43.    var shieldOn = false;
  44.    var control = true;
  45.    var exit = false;
  46.    var life = 0;
  47.    var gesture = false;
  48.    var sl = "top";
  49.    var ofc = 0;
  50.    var endFire = false;
  51.    var hover = true;
  52.    function Bro2(px, py)
  53.    {
  54.       this.tX = this.x = px;
  55.       this.tY = this.y = py;
  56.       this.clip = _root.attachMovie("bro2","bro2Clip",this.d);
  57.       this.w = this.clip._width;
  58.       this.h = this.clip._height;
  59.       this.clip._x = this.x;
  60.       this.clip._y = this.y;
  61.       this.weapon = _root.bro2Weapon;
  62.       this.trans = new flash.geom.Transform(this.clip);
  63.       this.colorTrans = new flash.geom.ColorTransform(1,1,1,1,0,0,0,0);
  64.       this.colorVars = new Object();
  65.       _root.rapidVar = 2;
  66.       this[this.weapon]();
  67.       var _loc3_ = _root.bro2ShipLevel <= 3 ? _root.bro2ShipLevel : _root.bro2ShipLevel - 3;
  68.       this.baseSpeed = this.speed = 6 + _loc3_;
  69.    }
  70.    function colorFlash(r, g, b, cMax)
  71.    {
  72.       this.colorVars.c = 0;
  73.       this.colorVars.r = r;
  74.       this.colorVars.g = g;
  75.       this.colorVars.b = b;
  76.       this.colorVars.cMax = cMax;
  77.       this.colorVars.flashing = true;
  78.    }
  79.    function wave()
  80.    {
  81.       this.clip.gotoAndPlay("wave" + this.facing);
  82.       this.fireDir = "";
  83.       this.gesture = true;
  84.    }
  85.    function hit()
  86.    {
  87.       if(this.c2 > 60 && this.f2 != "dying")
  88.       {
  89.          if(this.shieldOn && !this.inv)
  90.          {
  91.             _root.shield.hit();
  92.          }
  93.          else if(!this.inv)
  94.          {
  95.             this.xA = this.yA = 0;
  96.             this.control = false;
  97.             this.facing = "death";
  98.             this.fireDir = "";
  99.             this.f2 = "dying";
  100.             this.dc = 0;
  101.             _root.rescue = false;
  102.             _root.audio.playLevel2("broDeath",25);
  103.          }
  104.       }
  105.    }
  106.    function dying()
  107.    {
  108.       this.dc = this.dc + 1;
  109.       this.colorTrans.redMultiplier = 0;
  110.       this.colorTrans.greenMultiplier = 0;
  111.       this.colorTrans.blueMultiplier = 0;
  112.       this.colorTrans.redOffset = 0;
  113.       this.colorTrans.greenOffset = 0;
  114.       this.colorTrans.blueOffset = 0;
  115.       var _loc3_ = random(4);
  116.       if(_loc3_ == 0)
  117.       {
  118.          this.colorTrans.redOffset = 255;
  119.          this.colorTrans.redMultiplier = 1;
  120.       }
  121.       else if(_loc3_ == 1)
  122.       {
  123.          this.colorTrans.greenOffset = 255;
  124.          this.colorTrans.greenMultiplier = 1;
  125.       }
  126.       else if(_loc3_ == 2)
  127.       {
  128.          this.colorTrans.blueOffset = 255;
  129.          this.colorTrans.blueMultiplier = 1;
  130.       }
  131.       else
  132.       {
  133.          this.colorTrans.redOffset = 255;
  134.          this.colorTrans.greenOffset = 255;
  135.          this.colorTrans.blueOffset = 255;
  136.       }
  137.       this.trans.colorTransform = this.colorTrans;
  138.       this.clip._alpha = 100 - this.dc * 1.6;
  139.       if(this.dc == 60)
  140.       {
  141.          if(_root.char2 == "broShip1")
  142.          {
  143.             var _loc4_ = _root["advanceDir" + _root.level] != "L" ? 1010 : -45;
  144.             if(_root.broShip1.bg)
  145.             {
  146.                _root.bgWait = new classes.misc.BGWait(_loc4_,"bro1",false);
  147.                _root.addFX("bgWait");
  148.             }
  149.             else if(!_root.broShip1.tagTeaming)
  150.             {
  151.                _root.broShip1 = new classes.bro.BroShip1(_loc4_,280);
  152.                _root.addChar("broShip1");
  153.                _root.broShip1.appear();
  154.                _root.char = "broShip1";
  155.                _root.char2 = "dead";
  156.             }
  157.             else
  158.             {
  159.                _root.broShip1.tagTeaming = false;
  160.                _root.broShip1.giveControl();
  161.                _root.char = "broShip1";
  162.                _root.char2 = "dead";
  163.             }
  164.             _root.rescue = false;
  165.             _root.createPowerUp([this.x,this.y,this.weapon]);
  166.             _root.createPowerUp([this.x,this.y,"lifeMax"]);
  167.          }
  168.          else if(_root.char2 == "bro1")
  169.          {
  170.             _loc4_ = _root["advanceDir" + _root.level] != "L" ? 1010 : -45;
  171.             _root.bro1 = new classes.bro.Bro1(_loc4_,280);
  172.             _root.addChar("bro1");
  173.             _root.bro1.appear();
  174.             _root.char = "bro1";
  175.             _root.char2 = "dead";
  176.             _root.createPowerUp([this.x,this.y,this.weapon]);
  177.             _root.shield = new classes.misc.Shield();
  178.             _root.addPowerUp("shield");
  179.             _root[_root.char].shieldOn = true;
  180.          }
  181.          else
  182.          {
  183.             _root.gameOver();
  184.          }
  185.          _root.removeChar("bro2");
  186.       }
  187.    }
  188.    function nudge(pxA, pyA, pscale)
  189.    {
  190.       if((this.c == 0 || this.c > 5) && !this.inv && this.f2 != "dying")
  191.       {
  192.          this.c = 0;
  193.          var _loc2_ = pscale / 100;
  194.          this.xA = pxA * _loc2_;
  195.          this.yA = pyA * _loc2_;
  196.          this.f2 = "nudging";
  197.       }
  198.    }
  199.    function nudging()
  200.    {
  201.       this.xA *= 0.75;
  202.       this.yA *= 0.75;
  203.       this.c = this.c + 1;
  204.       if(this.c == 20)
  205.       {
  206.          this.xA = this.yA = 0;
  207.          this.f2 = "";
  208.          this.c = 0;
  209.       }
  210.    }
  211.    function powerUp(type)
  212.    {
  213.       if(type.substr(0,10) == "speedBoost")
  214.       {
  215.          var _loc3_ = Number(type.substr(10));
  216.          this.speedBoost(_loc3_ * 300);
  217.       }
  218.       else if(type.substr(0,11) == "weaponBoost")
  219.       {
  220.          _loc3_ = Number(type.substr(11));
  221.          this.weaponBoost(_loc3_ * 200);
  222.       }
  223.       else
  224.       {
  225.          this[type]();
  226.       }
  227.    }
  228.    function coin1()
  229.    {
  230.       _root.coins.addTo(1);
  231.       this.colorFlash(200,200,200,10);
  232.    }
  233.    function coin5()
  234.    {
  235.       _root.coins.addTo(5);
  236.       this.colorFlash(200,200,200,10);
  237.    }
  238.    function coin10()
  239.    {
  240.       _root.coins.addTo(10);
  241.       this.colorFlash(200,200,0,10);
  242.    }
  243.    function coin25()
  244.    {
  245.       _root.coins.addTo(25);
  246.       this.colorFlash(200,200,0,10);
  247.    }
  248.    function stealCoins(num)
  249.    {
  250.       if(!this.shieldOn && !this.inv)
  251.       {
  252.          _root.audio.playLevel2("coinDrain2",25);
  253.          var _loc4_ = random(num) + 2;
  254.          if(_root.coins.num - _loc4_ < 0)
  255.          {
  256.             _loc4_ = _root.coins.num;
  257.          }
  258.          _root.coins.addTo(-1 * _loc4_);
  259.          var _loc3_ = 0;
  260.          while(_loc3_ < _loc4_)
  261.          {
  262.             _root.fxID = _root.fxID + 1;
  263.             _root["coinDrain" + _root.fxID] = new classes.fx.CoinDrain(this.x + 6,this.y + 6,_root.fxID);
  264.             _root.addFX("coinDrain" + _root.fxID);
  265.             _loc3_ = _loc3_ + 1;
  266.          }
  267.       }
  268.    }
  269.    function gem1()
  270.    {
  271.       _root.gems.addTo(1);
  272.       this.colorFlash(40,255,180,15);
  273.    }
  274.    function gem2()
  275.    {
  276.       _root.gems.addTo(1);
  277.       this.colorFlash(0,90,200,15);
  278.    }
  279.    function gem3()
  280.    {
  281.       _root.gems.addTo(1);
  282.       this.colorFlash(255,50,0,15);
  283.    }
  284.    function gem4()
  285.    {
  286.       _root.gems.addTo(1);
  287.       this.colorFlash(255,170,30,15);
  288.    }
  289.    function gem5()
  290.    {
  291.       _root.gems.addTo(1);
  292.       this.colorFlash(255,100,255,15);
  293.    }
  294.    function gem6()
  295.    {
  296.       _root.gems.addTo(1);
  297.       this.colorFlash(0,255,180,15);
  298.    }
  299.    function smartBomb()
  300.    {
  301.       _root.smartBomb.gotoAndPlay(2);
  302.       var _loc2_ = 1;
  303.       var _loc3_ = _root.chars.length;
  304.       while(_loc2_ < _loc3_)
  305.       {
  306.          _root[_root.chars[_loc2_]].bombed(20);
  307.          _loc2_ = _loc2_ + 1;
  308.       }
  309.       _loc2_ = 0;
  310.       _loc3_ = _root.enemyShots.length;
  311.       var _loc4_ = _root.enemyShots.slice();
  312.       while(_loc2_ < _loc3_)
  313.       {
  314.          _root[_loc4_[_loc2_]].bombed();
  315.          _loc2_ = _loc2_ + 1;
  316.       }
  317.       _loc2_ = 0;
  318.       _loc3_ = _root.FX.length;
  319.       _loc4_ = _root.FX.slice();
  320.       while(_loc2_ < _loc3_)
  321.       {
  322.          _root[_loc4_[_loc2_]].bombed();
  323.          _loc2_ = _loc2_ + 1;
  324.       }
  325.    }
  326.    function superP()
  327.    {
  328.       this.weaponBoost(600);
  329.       this.speedBoost(600);
  330.       this.shield();
  331.    }
  332.    function shield()
  333.    {
  334.       if(!this.shieldOn)
  335.       {
  336.          _root.shield = new classes.misc.Shield();
  337.          _root.addPowerUp("shield");
  338.          this.shieldOn = true;
  339.       }
  340.       else if(_root.shield.out)
  341.       {
  342.          _root.shield.renew();
  343.       }
  344.       this.colorFlash(70,180,250,30);
  345.    }
  346.    function rampage()
  347.    {
  348.       var _loc2_ = 0;
  349.       var _loc3_ = _root.powerUps.length;
  350.       while(_loc2_ < _loc3_)
  351.       {
  352.          if(_root.powerUps[_loc2_] == "rampage")
  353.          {
  354.             _root.removePowerUp("rampage");
  355.             break;
  356.          }
  357.          _loc2_ = _loc2_ + 1;
  358.       }
  359.       _root.rampage = new classes.misc.Rampage(300);
  360.       _root.addPowerUp("rampage");
  361.    }
  362.    function weaponBoost(num)
  363.    {
  364.       if(this.weapon == "laserA" || this.weapon == "doubleLaserA" || this.weapon == "tripleLaserA" || this.weapon == "bigLaser" || this.weapon == "twistLaser" || this.weapon == "tripleTwistLaser")
  365.       {
  366.          if(_root.currentBoost == "rapidFire")
  367.          {
  368.             _root.removePowerUp("rapidFire");
  369.          }
  370.          _root.currentBoost = "rapidFire";
  371.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  372.          if(this.weapon != "bigLaser")
  373.          {
  374.             _root.rapidFire = new classes.misc.RapidFire(num,false);
  375.          }
  376.          else
  377.          {
  378.             _root.rapidFire = new classes.misc.RapidFire(num,true);
  379.          }
  380.          _root.addPowerUp("rapidFire");
  381.       }
  382.       if(this.weapon == "rapidLaser" || this.weapon == "doubleRapidLaser")
  383.       {
  384.          if(_root.currentBoost == "laserBoost")
  385.          {
  386.             _root.removePowerUp("laserBoost");
  387.          }
  388.          _root.currentBoost = "laserBoost";
  389.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  390.          _root.laserBoost = new classes.misc.LaserBoost(num);
  391.          _root.addPowerUp("laserBoost");
  392.       }
  393.       if(this.weapon == "superLaser")
  394.       {
  395.          if(_root.currentBoost == "superRapidFire")
  396.          {
  397.             _root.removePowerUp("superRapidFire");
  398.          }
  399.          _root.currentBoost = "superRapidFire";
  400.          this.clip.gun[this.weapon].gotoAndPlay("rapidFire");
  401.          _root.superRapidFire = new classes.misc.SuperRapidFire(num);
  402.          _root.addPowerUp("superRapidFire");
  403.       }
  404.       this.colorFlash(255,125,0,30);
  405.    }
  406.    function checkBoost()
  407.    {
  408.       if(_root.currentBoost != "")
  409.       {
  410.          _root.removePowerUp(_root.currentBoost);
  411.          _root.currentBoost = "";
  412.          _root.laserPower = 8;
  413.       }
  414.    }
  415.    function laserA()
  416.    {
  417.       this.checkBoost();
  418.       _root.rapidVar = 2;
  419.       this.fireFreq = 11;
  420.       this.fireFreqOrig = 11;
  421.       this.clip.gun.gotoAndStop(this.weapon);
  422.    }
  423.    function doubleLaserA()
  424.    {
  425.       this.checkBoost();
  426.       _root.rapidVar = 2;
  427.       this.fireFreq = 11;
  428.       this.fireFreqOrig = 11;
  429.       _root.bro2Weapon = this.weapon = "doubleLaserA";
  430.       this.clip.gun.gotoAndStop(this.weapon);
  431.       this.colorFlash(200,200,0,30);
  432.    }
  433.    function tripleLaserA()
  434.    {
  435.       this.checkBoost();
  436.       _root.rapidVar = 2;
  437.       this.fireFreq = 11;
  438.       this.fireFreqOrig = 11;
  439.       _root.bro2Weapon = this.weapon = "tripleLaserA";
  440.       this.clip.gun.gotoAndStop(this.weapon);
  441.       this.colorFlash(255,160,0,30);
  442.    }
  443.    function twistLaser()
  444.    {
  445.       this.checkBoost();
  446.       _root.rapidVar = 2;
  447.       this.fireFreq = 10;
  448.       this.fireFreqOrig = 10;
  449.       _root.bro2Weapon = this.weapon = "twistLaser";
  450.       this.colorFlash(100,200,230,30);
  451.    }
  452.    function tripleTwistLaser()
  453.    {
  454.       this.checkBoost();
  455.       _root.rapidVar = 2;
  456.       this.fireFreq = 10;
  457.       this.fireFreqOrig = 10;
  458.       _root.bro2Weapon = this.weapon = "tripleTwistLaser";
  459.       this.colorFlash(100,200,230,30);
  460.    }
  461.    function rapidLaser()
  462.    {
  463.       this.checkBoost();
  464.       _root.rapidVar = 2;
  465.       this.fireFreq = 4;
  466.       this.fireFreqOrig = 4;
  467.       _root.bro2Weapon = this.weapon = "rapidLaser";
  468.       this.clip.gun.gotoAndStop(this.weapon);
  469.       this.colorFlash(0,230,190,30);
  470.    }
  471.    function bigLaser()
  472.    {
  473.       this.checkBoost();
  474.       _root.rapidVar = 4;
  475.       this.fireFreq = 9;
  476.       this.fireFreqOrig = 9;
  477.       _root.bro2Weapon = this.weapon = "bigLaser";
  478.       this.clip.gun.gotoAndStop(this.weapon);
  479.       this.colorFlash(0,130,255,30);
  480.    }
  481.    function superLaser()
  482.    {
  483.       this.checkBoost();
  484.       _root.rapidVar = 2;
  485.       this.fireFreq = 5;
  486.       this.fireFreqOrig = 5;
  487.       _root.bro2Weapon = this.weapon = "superLaser";
  488.       this.colorFlash(255,255,255,30);
  489.    }
  490.    function speedBoost(num)
  491.    {
  492.       var _loc3_ = 0;
  493.       var _loc4_ = _root.powerUps.length;
  494.       while(_loc3_ < _loc4_)
  495.       {
  496.          if(_root.powerUps[_loc3_] == "speedBoost")
  497.          {
  498.             _root.removePowerUp("speedBoost");
  499.             break;
  500.          }
  501.          _loc3_ = _loc3_ + 1;
  502.       }
  503.       _root.speedBoost = new classes.misc.SpeedBoost(num);
  504.       _root.addPowerUp("speedBoost");
  505.       this.colorFlash(0,255,0,60);
  506.    }
  507.    function fire_laserA()
  508.    {
  509.       _root.audio.playLevel5("laserA" + (random(5) + 1),random(4) + 6);
  510.       this.shotID = this.shotID + 1;
  511.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  512.       _root.addBroShot("laserA" + this.shotID);
  513.       this.clip.gun.blast.gotoAndPlay("go");
  514.    }
  515.    function fire_twistLaser()
  516.    {
  517.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  518.       this.shotID = this.shotID + 1;
  519.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  520.       _root.addBroShot("twistLaser" + this.shotID);
  521.       this.shotID = this.shotID + 1;
  522.       _root["twistLaser" + this.shotID] = new classes.bro.TwistLaser(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  523.       _root.addBroShot("twistLaser" + this.shotID);
  524.       this.clip.gun.blast.gotoAndPlay("go");
  525.    }
  526.    function fire_tripleTwistLaser()
  527.    {
  528.       _root.audio.playLevel5("twist" + (random(3) + 1),random(10) + 8);
  529.       this.shotID = this.shotID + 1;
  530.       _root["twistLaserB" + this.shotID] = new classes.bro.TwistLaserB(this.shotX,this.shotY,this.fireDir,this.shotID);
  531.       _root.addBroShot("twistLaserB" + this.shotID);
  532.       this.shotID = this.shotID + 1;
  533.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  534.       _root.addBroShot("twistLaserC" + this.shotID);
  535.       this.shotID = this.shotID + 1;
  536.       _root["twistLaserC" + this.shotID] = new classes.bro.TwistLaserC(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  537.       _root.addBroShot("twistLaserC" + this.shotID);
  538.       this.clip.gun.blast.gotoAndPlay("go");
  539.    }
  540.    function fire_doubleLaserA()
  541.    {
  542.       _root.audio.playLevel5("doubleLaserA" + (random(5) + 1),random(10) + 8);
  543.       if(this.fireDir == "R" || this.fireDir == "L")
  544.       {
  545.          var _loc6_ = 0;
  546.          var _loc4_ = -3;
  547.          var _loc5_ = 0;
  548.          var _loc3_ = 9;
  549.       }
  550.       else
  551.       {
  552.          _loc6_ = -6;
  553.          _loc4_ = 0;
  554.          _loc5_ = 6;
  555.          _loc3_ = 0;
  556.       }
  557.       this.shotID = this.shotID + 1;
  558.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  559.       _root.addBroShot("laserA" + this.shotID);
  560.       this.shotID = this.shotID + 1;
  561.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  562.       _root.addBroShot("laserA" + this.shotID);
  563.       this.clip.gun.blast.gotoAndPlay("go");
  564.       this.clip.gun.blast2.gotoAndPlay("go");
  565.    }
  566.    function fire_tripleLaserA()
  567.    {
  568.       _root.audio.playLevel5("tripleLaserA" + (random(5) + 1),random(10) + 8);
  569.       if(this.fireDir == "R" || this.fireDir == "L")
  570.       {
  571.          var _loc6_ = 0;
  572.          var _loc4_ = -3;
  573.          var _loc5_ = 0;
  574.          var _loc3_ = 3;
  575.       }
  576.       else
  577.       {
  578.          _loc6_ = -3;
  579.          _loc4_ = 0;
  580.          _loc5_ = 3;
  581.          _loc3_ = 0;
  582.       }
  583.       this.shotID = this.shotID + 1;
  584.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,1,this.shotID);
  585.       _root.addBroShot("spreadLaserA" + this.shotID);
  586.       this.shotID = this.shotID + 1;
  587.       _root["laserA" + this.shotID] = new classes.bro.LaserA(this.shotX,this.shotY,this.fireDir,this.shotID);
  588.       _root.addBroShot("laserA" + this.shotID);
  589.       this.shotID = this.shotID + 1;
  590.       _root["spreadLaserA" + this.shotID] = new classes.bro.SpreadLaserA(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,2,this.shotID);
  591.       _root.addBroShot("spreadLaserA" + this.shotID);
  592.       this.clip.gun.blast.gotoAndPlay("go");
  593.       this.clip.gun.blast2.gotoAndPlay("go");
  594.    }
  595.    function fire_rapidLaser()
  596.    {
  597.       if(this.fireDir == "R" || this.fireDir == "L")
  598.       {
  599.          var _loc6_ = 0;
  600.          var _loc4_ = -6;
  601.          var _loc5_ = 0;
  602.          var _loc3_ = 6;
  603.       }
  604.       else
  605.       {
  606.          _loc6_ = -6;
  607.          _loc4_ = 0;
  608.          _loc5_ = 6;
  609.          _loc3_ = 0;
  610.       }
  611.       _root.audio.playLevel5("rapidLaser" + (random(5) + 1),random(30) + 10);
  612.       this.shotID = this.shotID + 1;
  613.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc6_,this.shotY + _loc4_,this.fireDir,this.shotID);
  614.       _root.addBroShot("rapidLaser" + this.shotID);
  615.       this.shotID = this.shotID + 1;
  616.       _root["rapidLaser" + this.shotID] = new classes.bro.RapidLaser(this.shotX + _loc5_,this.shotY + _loc3_,this.fireDir,this.shotID);
  617.       _root.addBroShot("rapidLaser" + this.shotID);
  618.       this.clip.gun.blast.gotoAndPlay("go");
  619.    }
  620.    function fire_bigLaser()
  621.    {
  622.       _root.audio.playLevel5("bigLaser" + (random(3) + 1),random(10) + 8);
  623.       this.shotID = this.shotID + 1;
  624.       _root["bigLaser" + this.shotID] = new classes.bro.BigLaser(this.shotX,this.shotY,this.fireDir,this.shotID);
  625.       _root.addBroShot("bigLaser" + this.shotID);
  626.       this.clip.gun.blast.gotoAndPlay("go2");
  627.       if(this.fireDir == "U")
  628.       {
  629.          this.nudge(0,4,100);
  630.       }
  631.       else if(this.fireDir == "D")
  632.       {
  633.          this.nudge(0,-4,100);
  634.       }
  635.       else if(this.fireDir == "L")
  636.       {
  637.          this.nudge(4,0,100);
  638.       }
  639.       else
  640.       {
  641.          this.nudge(-4,0,100);
  642.       }
  643.    }
  644.    function fire_superLaser()
  645.    {
  646.       _root.audio.playLevel5("superLaser" + (random(3) + 1),random(10) + 8);
  647.       if(this.sl == "top")
  648.       {
  649.          this.sl = "bot";
  650.          if(this.fireDir == "R" || this.fireDir == "L")
  651.          {
  652.             var _loc4_ = 0;
  653.             var _loc3_ = 6;
  654.          }
  655.          else
  656.          {
  657.             _loc4_ = 6;
  658.             _loc3_ = 0;
  659.          }
  660.       }
  661.       else
  662.       {
  663.          this.sl = "top";
  664.          if(this.fireDir == "R" || this.fireDir == "L")
  665.          {
  666.             _loc4_ = 0;
  667.             _loc3_ = -6;
  668.          }
  669.          else
  670.          {
  671.             _loc4_ = -6;
  672.             _loc3_ = 0;
  673.          }
  674.       }
  675.       this.shotID = this.shotID + 1;
  676.       _root["superLaserA" + this.shotID] = new classes.bro.SuperLaserA(this.shotX + _loc4_,this.shotY + _loc3_,this.fireDir,this.shotID);
  677.       _root.addBroShot("superLaserA" + this.shotID);
  678.       this.shotID = this.shotID + 1;
  679.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"top",this.shotID);
  680.       _root.addBroShot("superLaserB" + this.shotID);
  681.       this.shotID = this.shotID + 1;
  682.       _root["superLaserB" + this.shotID] = new classes.bro.SuperLaserB(this.shotX,this.shotY,this.fireDir,"bot",this.shotID);
  683.       _root.addBroShot("superLaserB" + this.shotID);
  684.       this.clip.gun.blast.gotoAndPlay("go2");
  685.       if(this.fireDir == "U")
  686.       {
  687.          this.nudge(0,4,100);
  688.       }
  689.       else if(this.fireDir == "D")
  690.       {
  691.          this.nudge(0,-4,100);
  692.       }
  693.       else if(this.fireDir == "L")
  694.       {
  695.          this.nudge(4,0,100);
  696.       }
  697.       else
  698.       {
  699.          this.nudge(-4,0,100);
  700.       }
  701.    }
  702.    function action11()
  703.    {
  704.       this.speed = 9;
  705.       this.control = false;
  706.       this.exit = true;
  707.       this.facing = "R";
  708.       this.fireDir = "";
  709.       this.gotoXY(1300,0);
  710.    }
  711.    function positionForSwitch(pdestY)
  712.    {
  713.       this.control = false;
  714.       this.gotoXY(0,pdestY,"action6B");
  715.       this.fireDir = "";
  716.       this.facing = "R";
  717.    }
  718.    function action6B()
  719.    {
  720.       this.gotoXY(_root.newShipClip._x + 9,0);
  721.    }
  722.    function getInShip(pdestY)
  723.    {
  724.       this.gotoXY(0,pdestY);
  725.    }
  726.    function getInOldShipA()
  727.    {
  728.       this.exit = true;
  729.       this.control = false;
  730.       this.fireDir = "";
  731.       this.facing = "R";
  732.       this.gotoXY(_root.newShipClip._x - 94,0,"getInOldShipB");
  733.    }
  734.    function getInOldShipB()
  735.    {
  736.       this.gotoXY(0,_root.newShipClip._y + 3,"getInOldShipC");
  737.    }
  738.    function getInOldShipC()
  739.    {
  740.       _root.bro2ShipLevel = _root.tempShipLevel;
  741.       _root.bro2ShipVar = _root.tempShipVar;
  742.       delete _root.tempShipLevel;
  743.       delete _root.tempShipVar;
  744.       _root.bro2Life = _root.tempLife;
  745.       delete _root.tempLife;
  746.       _root.broShip2 = new classes.bro.BroShip2(_root.newShipClip._x,_root.newShipClip._y);
  747.       _root.addChar("broShip2");
  748.       _root.char2 = "broShip2";
  749.       _root.newShipClip.removeMovieClip();
  750.       _root.broShip2.control = false;
  751.       _root.broShip2.facing = "R";
  752.       _root.broShip2.fireDir = "";
  753.       _root.broShip2.clip.body.getOut = true;
  754.       _root.broShip2.clip.body.gotoAndPlay("close");
  755.       _root.removeChar("bro2");
  756.    }
  757.    function endSeq(pdir)
  758.    {
  759.       this.speed = this.baseSpeed = 7;
  760.       this.exit = true;
  761.       this.weapon = "rapidLaser";
  762.       _root.bro2weapon = this.weapon;
  763.       this[this.weapon]();
  764.       this.facing = this.fireDir = pdir;
  765.       this.control = false;
  766.       var _loc3_ = this.facing != "L" ? 200 : 800;
  767.       this.gotoXY(_loc3_,280);
  768.    }
  769.    function endSeqB()
  770.    {
  771.       this.gotoXY(0,_root.deathHeadClip._y);
  772.    }
  773.    function endSeqMove()
  774.    {
  775.       this.speed = this.baseSpeed = 9;
  776.       this.endFire = true;
  777.       this.gotoXY(_root.randRange(100,900),_root.randRange(100,500),"endSeqMove");
  778.    }
  779.    function endStill()
  780.    {
  781.       this.endFire = false;
  782.       this.dirX = this.dirY = this.fireDir = "";
  783.       this.f2 = "";
  784.    }
  785.    function endPos()
  786.    {
  787.       this.xA = this.yA = 0;
  788.       this.speed = 2;
  789.       this.control = false;
  790.       this.facing = "L";
  791.       this.fireDir = "";
  792.       this.gotoXY(357,250);
  793.    }
  794.    function endPos2()
  795.    {
  796.       this.xA = this.yA = 0;
  797.       this.clip._x = this.x = this.tX = 357;
  798.       this.gotoXY(0,471,"endPos3");
  799.    }
  800.    function endPos3()
  801.    {
  802.       this.xA = this.yA = this.speed = 0;
  803.       this.hover = false;
  804.       _root.endBGClip.clip.buzzPack._visible = true;
  805.       _root.endBGClip.clip.buzzPack.play();
  806.       _root.removeChar("bro2");
  807.    }
  808.    function appear()
  809.    {
  810.       this.exit = true;
  811.       this.inv = true;
  812.       this.control = false;
  813.       if(this.x < 0)
  814.       {
  815.          this.facing = "R";
  816.          this.fireDir = "R";
  817.          this.gotoXY(150,0,"giveControl");
  818.       }
  819.       else
  820.       {
  821.          this.facing = "L";
  822.          this.fireDir = "L";
  823.          this.gotoXY(850,0,"giveControl");
  824.       }
  825.    }
  826.    function giveControl()
  827.    {
  828.       this.inv = false;
  829.       this.control = true;
  830.       this.exit = false;
  831.    }
  832.    function gotoXY(pdestX, pdestY, pmetFunction, pwave)
  833.    {
  834.       this.destX = pdestX;
  835.       this.destY = pdestY;
  836.       this.xyMetFunction = pmetFunction;
  837.       var _loc2_ = pwave;
  838.       if(this.destX != 0)
  839.       {
  840.          this.dirX = this.x <= this.destX ? "R" : "L";
  841.       }
  842.       if(this.destY != 0)
  843.       {
  844.          this.dirY = this.y <= this.destY ? "D" : "U";
  845.       }
  846.       this.f2 = "goingXY";
  847.       if(_loc2_)
  848.       {
  849.          this.wave();
  850.       }
  851.    }
  852.    function goingXY()
  853.    {
  854.       if(this.destX != 0 && Math.abs(this.x - this.destX) < this.speed + 1)
  855.       {
  856.          this.dirX = "";
  857.          var _loc2_ = true;
  858.       }
  859.       if(this.destX == 0)
  860.       {
  861.          _loc2_ = true;
  862.       }
  863.       if(this.destY != 0 && Math.abs(this.y - this.destY) < this.speed + 1)
  864.       {
  865.          this.dirY = "";
  866.          var _loc3_ = true;
  867.       }
  868.       if(this.destY == 0)
  869.       {
  870.          _loc3_ = true;
  871.       }
  872.       if(_loc2_ && _loc3_)
  873.       {
  874.          this[this.xyMetFunction]();
  875.       }
  876.    }
  877.    function changeDir()
  878.    {
  879.       this.dirX = this.dirXArray[random(this.dirXArray.length)];
  880.       this.dirY = this.dirYArray[random(this.dirYArray.length)];
  881.    }
  882.    function wander()
  883.    {
  884.       if(random(100) > 93)
  885.       {
  886.          this.changeDir();
  887.       }
  888.    }
  889.    function main()
  890.    {
  891.       this.c2 = this.c2 + 1;
  892.       this[this.f2]();
  893.       if(this.endFire)
  894.       {
  895.          if(random(30) == 0)
  896.          {
  897.             var _loc4_ = ["L","R","D","U","","","",""];
  898.             this.fireDir = _loc4_[random(8)];
  899.          }
  900.          if(random(60) == 0)
  901.          {
  902.             this.dirX = this.dirY = "";
  903.             this.f2 = "";
  904.          }
  905.          else if(random(45) == 0)
  906.          {
  907.             this.endSeqMove();
  908.          }
  909.       }
  910.       if(this.control)
  911.       {
  912.          this.legState = "still";
  913.          if(Key.isDown(_root.moveU))
  914.          {
  915.             this.tY = this.y - this.speed;
  916.             this.legState = "U";
  917.          }
  918.          if(Key.isDown(_root.moveD))
  919.          {
  920.             this.tY = this.y + this.speed;
  921.             this.legState = "D";
  922.          }
  923.          if(Key.isDown(_root.moveL))
  924.          {
  925.             this.tX = this.x - this.speed;
  926.             this.legState = this.facing != "L" ? "B" : "F";
  927.          }
  928.          if(Key.isDown(_root.moveR))
  929.          {
  930.             this.tX = this.x + this.speed;
  931.             this.legState = this.facing != "R" ? "B" : "F";
  932.          }
  933.          if(Key.isDown(_root.fireU))
  934.          {
  935.             this.fire = true;
  936.             this.shotY = this.y - 3;
  937.             this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
  938.             this.fireDir = "U";
  939.          }
  940.          else if(Key.isDown(_root.fireD))
  941.          {
  942.             this.fire = true;
  943.             this.shotY = this.y + 39;
  944.             this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
  945.             this.fireDir = "D";
  946.          }
  947.          else if(Key.isDown(_root.fireL))
  948.          {
  949.             this.fire = true;
  950.             this.shotX = this.x - 9;
  951.             this.shotY = this.y + 21;
  952.             this.fireDir = this.facing = "L";
  953.          }
  954.          else if(Key.isDown(_root.fireR))
  955.          {
  956.             this.fire = true;
  957.             this.shotX = this.x + 30;
  958.             this.shotY = this.y + 21;
  959.             this.fireDir = this.facing = "R";
  960.          }
  961.          else
  962.          {
  963.             this.fire = false;
  964.             this.fireDir = this.facing != "R" ? "L" : "R";
  965.             this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  966.             this.fc = this.fc + 1;
  967.          }
  968.          if(this.oldLegState != this.legState)
  969.          {
  970.             this.clip.legs.gotoAndStop(this.legState);
  971.             this.clip.flame.gotoAndPlay(this.legState);
  972.          }
  973.          this.oldLegState = this.legState;
  974.       }
  975.       else
  976.       {
  977.          this.legState = "still";
  978.          if(this.dirY == "U")
  979.          {
  980.             this.tY = this.y - this.speed;
  981.             this.legState = "U";
  982.          }
  983.          if(this.dirY == "D")
  984.          {
  985.             this.tY = this.y + this.speed;
  986.             this.legState = "D";
  987.          }
  988.          if(this.dirX == "L")
  989.          {
  990.             this.tX = this.x - this.speed;
  991.             this.legState = this.facing != "L" ? "B" : "F";
  992.          }
  993.          if(this.dirX == "R")
  994.          {
  995.             this.tX = this.x + this.speed;
  996.             this.legState = this.facing != "R" ? "B" : "F";
  997.          }
  998.          if(this.fireDir == "U")
  999.          {
  1000.             this.fire = true;
  1001.             this.shotY = this.y - 3;
  1002.             this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
  1003.             this.fireDir = "U";
  1004.          }
  1005.          else if(this.fireDir == "D")
  1006.          {
  1007.             this.fire = true;
  1008.             this.shotY = this.y + 39;
  1009.             this.shotX = this.facing != "R" ? this.x + 3 : this.x + 15;
  1010.             this.fireDir = "D";
  1011.          }
  1012.          else if(this.fireDir == "L")
  1013.          {
  1014.             this.fire = true;
  1015.             this.shotX = this.x - 9;
  1016.             this.shotY = this.y + 21;
  1017.             this.fireDir = this.facing = "L";
  1018.          }
  1019.          else if(this.fireDir == "R")
  1020.          {
  1021.             this.fire = true;
  1022.             this.shotX = this.x + 30;
  1023.             this.shotY = this.y + 21;
  1024.             this.fireDir = this.facing = "R";
  1025.          }
  1026.          else
  1027.          {
  1028.             this.fire = false;
  1029.             var _loc3_ = this.facing != "R" ? "L" : "R";
  1030.             if(this.facing != "death" && !this.gesture)
  1031.             {
  1032.                this.clip.gotoAndStop("face" + this.facing + "fire" + _loc3_);
  1033.             }
  1034.             this.fc = this.fc + 1;
  1035.          }
  1036.          if(this.oldLegState != this.legState)
  1037.          {
  1038.             this.clip.legs.gotoAndStop(this.legState);
  1039.             this.clip.flame.gotoAndPlay(this.legState);
  1040.          }
  1041.          this.oldLegState = this.legState;
  1042.       }
  1043.       if(this.colorVars.flashing)
  1044.       {
  1045.          this.colorVars.c = this.colorVars.c + 1;
  1046.          this.colorTrans.redOffset = this.colorVars.r - this.colorVars.c * (this.colorVars.r / this.colorVars.cMax);
  1047.          this.colorTrans.greenOffset = this.colorVars.g - this.colorVars.c * (this.colorVars.g / this.colorVars.cMax);
  1048.          this.colorTrans.blueOffset = this.colorVars.b - this.colorVars.c * (this.colorVars.b / this.colorVars.cMax);
  1049.          if(this.colorVars.c >= this.colorVars.cMax)
  1050.          {
  1051.             this.colorVars.flashing = false;
  1052.             this.colorTrans.redOffset = 0;
  1053.             this.colorTrans.greenOffset = 0;
  1054.             this.colorTrans.blueOffset = 0;
  1055.          }
  1056.          this.trans.colorTransform = this.colorTrans;
  1057.       }
  1058.       if(!this.exit)
  1059.       {
  1060.          if(this.tX < 35)
  1061.          {
  1062.             this.tX = 35;
  1063.          }
  1064.          if(this.tX > 965 - this.w)
  1065.          {
  1066.             this.tX = 965 - this.w;
  1067.          }
  1068.          if(this.tY < 35)
  1069.          {
  1070.             this.tY = 35;
  1071.          }
  1072.          if(this.tY > 565 - this.h)
  1073.          {
  1074.             this.tY = 565 - this.h;
  1075.          }
  1076.       }
  1077.       else if(this.x > 1050 || this.x < -50 || this.y < -50 || this.y > 650)
  1078.       {
  1079.          _root.removeChar("bro2");
  1080.       }
  1081.       if(this.fire)
  1082.       {
  1083.          this.clip.gotoAndStop("face" + this.facing + "fire" + this.fireDir);
  1084.          if(this.fc <= this.ofc)
  1085.          {
  1086.             this.fc = this.ofc + 1;
  1087.          }
  1088.          else
  1089.          {
  1090.             this.fc = this.fc + 1;
  1091.          }
  1092.          if(this.fc > this.fireFreq)
  1093.          {
  1094.             this.fc = 0;
  1095.             this["fire_" + this.weapon]();
  1096.          }
  1097.          this.ofc = this.fc;
  1098.       }
  1099.       this.tX += this.xA;
  1100.       this.tY = !this.hover ? this.tY + this.yA : this.tY + this.yA + 0.5 * Math.sin(this.hc += 0.1);
  1101.       this.x = this.tX;
  1102.       this.y = this.tY;
  1103.       this.clip._x = this.x;
  1104.       this.clip._y = this.y;
  1105.    }
  1106. }
  1107.